/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sudokuagentlocal;

import Klassen.Board;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Random;
import java.util.Scanner;

/**
 *
 * @author Serenity
 */
public class SudokuAgentLocal {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        
        int choice = 0;
        int subchoice = 0;
        int sudokuNr = 0;
        Random rand = new Random();
        
        Scanner scan = new Scanner (System.in);
        Board instance = new Board();
        
        
        
        try{
            FileInputStream file = new FileInputStream("SudokuLogo.txt"); 
            Scanner inStr = new Scanner(file);
            
            
            
        while(true){
            
            switch(choice){
                case 0:
                    
                    while(inStr.hasNext()){
                        System.out.println(inStr.nextLine());
                        //Thread.sleep(50);
                    }
                    
                    inStr.reset();
                    
                    System.out.println("\n\n1) Random Sudoku");
                    System.out.println("2) Select Sudoku");
                    System.out.println("3) Benchmark");
                    System.out.println("4) Exit \n");

                    System.out.print("Please Choose: ");
                    choice = scan.nextInt();
                    
                    subchoice = 0;
                    
                    break;
                    
                case 1:
                    sudokuNr = rand.nextInt(1255);
                    choice = 7;
                    break;
                    
                case 7:
                    
                    switch(subchoice){
                        case 0:
                            System.out.println("\n1) Automatic");
                            System.out.println("2) Manual\n");
                            
                            System.out.print("Please Choose: ");
                            subchoice = scan.nextInt();
                            
                            if(subchoice <1 && subchoice >2){
                                subchoice = 0;
                            }
                            
                            break;
                        
                        case 1: //Automatic
                            choice = 5;
                            
                            break;
                            
                        case 2: //Manal
                            choice = 6;
                            
                            break;
                    }
                    
                    break;
                    
                case 2:
                    
                    switch(subchoice){
                        case 0:
                            System.out.println("Choose a number between 0 and 1255");
                            sudokuNr = scan.nextInt();
                            
                            if(sudokuNr>=0 && sudokuNr<=1255){
                                choice = 7;
                            }
                            break;
                    }
                    
                    break;
                    
                case 5:
                    
                    instance.startAutomatic(sudokuNr);
                    choice = 0;
                    break;
                    
                case 6:
                    
                   instance.starManual(sudokuNr);
                    choice = 0;
                   break;
                    
                case 3:
                    instance.benchmark();
                    choice = 0;
                    break;
            }
            
            if(choice == 4)
            break;
        
        }
        
        }catch(IOException ioe){
            ioe.printStackTrace();
        }
        
        // TODO code application logic here
        //Board board = new Board();
        //board.start();
        //board.benchmark();
    }
}
